<template>
  <div>
    <table>
      id:<input type="text" v-model="id"><br>
      名字:<input type="text" v-model="name"><br>
      价格:<input type="text" v-model="price"><br>
      库存:<input type="text" v-model="inventory"><br>
      内容:<input type="text" v-model="content"><br>
      所属分类:<select>
      <option :value="data.id" v-for="data in datas">{{data.name}}</option>
    </select><br>
      <button @click="add">添加</button>
    </table>
  </div>
</template>

<script>
export default {
  name:'good_psot',
  data(){
    return{
      id:'',
      name:'',
      price:'',
      inventor:'',
      content:'',
      cate_id:''
    }
  },
  methods:{
    add(){
      let data = new FormData();
      data.append('id',this.id)
      data.append('name',this.name)
      data.append('price',this.price)
      data.append('inventory',this.inventor)
      data.append('content',this.content)
      data.append('cate_id',this.cate_id)
      this.axios.post('yt4/',data).then(res=>{
        this.$router.push('good_get')
      })
    }
  }

}
</script>

<style>

</style>
